import dictData from './dictData'
export const Dictfilter = function (filterStr, filterNm) {//字典过滤器
    let getStr = String(filterStr)
    let returnVal = ''
    const dicAry = Object.entries(dictData)
    if (!getStr.includes(',')) {
        dicAry.forEach(item => {
            if (filterNm === item[0]) {
                Object.entries(item[1]).forEach(forItem => {
                    if (getStr === forItem[0]) {
                        returnVal = forItem[1]
                    }
                })
            }
        })
    } else {
        let strAry = getStr.split(',')
        strAry.forEach(item => {
            dicAry.forEach(item2 => {
                if (filterNm === item2[0]) {
                    Object.entries(item2[1]).forEach(forItem => {
                        if (item === forItem[0]) {
                            returnVal += forItem[1]
                        }
                    })
                }
            })
        })
    }
    return returnVal
}
export default Dictfilter
